package com.songlanyun.modules.keywordsearch.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.songlanyun.common.drive.RootEntity;
import lombok.Data;

import java.io.Serializable;

/**
 * 关键词搜索
 * 
 * @author zx
 * @email 
 * @date 2021-03-06 11:32:25
 */
@Data
@TableName("yxt_system_key_word_search")
public class SystemKeyWordSearch extends RootEntity<Long,SystemKeyWordSearch> implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 
	 */
	@TableId
	private Long id;
	/**
	 * 
	 */
	private String keyWord;
	/**
	 * 搜索总次数
	 */
	private Long totalNum;
	/**
	 * 搜索月次数
	 */
	private Long monthNum;
	/**
	 * 搜索周次数
	 */
	private Long weekNum;
	/**
	 * 搜索今天次数
	 */
	private Long todayNum;

	@Override
	public Long getIdentity() {
		return this.id;
	}
	public SystemKeyWordSearch(){}
	public SystemKeyWordSearch(String keyWord){
		this.keyWord = keyWord;
		this.totalNum = 1L;
		this.monthNum = 1L;
		this.weekNum = 1L;
		this.todayNum = 1L;
	}
	public void addKeyWordSearchNum(){
		this.totalNum = addOne(this.totalNum);
		this.monthNum = addOne(this.monthNum);
		this.weekNum = addOne(this.weekNum);
		this.todayNum = addOne(this.todayNum);
	}
	public Long addOne(Long num){
		if( null != num ){
			return ++num;
		}else{
			return 1L;
		}
	}
}
